﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PSU.Models
{
    public class RepositorioComentario: IRepositorio<Comentario>
    {
        private psuDBDataContext db = new psuDBDataContext();

        public IQueryable<Comentario> FindAll()
        {
            return db.Comentarios;
        }

        public Comentario Get(int id)
        {
            return db.Comentarios.SingleOrDefault(d => d.IdComentario == id);
        }

        public void Add(Comentario ob)
        {
            db.Comentarios.InsertOnSubmit(ob);
        }

        public void Delete(Comentario ob)
        {
            db.Comentarios.DeleteOnSubmit(ob);
        }

        public void Save()
        {
            db.SubmitChanges();
        }
    }
}